package com.tjnmt.togo.activities;

import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.widget.Toast;

import com.tjnmt.togo.R;
import com.tjnmt.togo.Service.LocalService;

import org.xutils.view.annotation.ContentView;
import org.xutils.x;

import cn.jpush.android.api.JPushInterface;

/**
 *APP启动界面,在这里开启服务。
 */
@ContentView(value = R.layout.activity_start)
public class StartActivity extends BaseActivity {
    private static final int SPLASH_DISPLAY_LENGHT = 4000;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        x.view().inject(this);

        //启动鹰眼轨迹服务。
        startService(new Intent(this, LocalService.class));

        Toast.makeText(getApplicationContext(), "JPush注册ID：" + JPushInterface.getRegistrationID(this),Toast.LENGTH_SHORT).show();

        //延时启动。
        delaystart();
    }

    private void delaystart(){
        new Handler().postDelayed(new Runnable() {
            public void run() {

               // LoginActivity.actionStart(StartActivity.this);
                MainActivity.actionStart(StartActivity.this);
                finish();

            }
        }, SPLASH_DISPLAY_LENGHT);
    }

}
